import { createApp } from 'vue'
import '@/style.css'
import App from '@/App.vue'

import router from '@/router'
import store from '@/store'

import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
// 导入中文语言包
import zhCn from 'element-plus/es/locale/lang/zh-cn'

import * as ElementPlusIconsVue from '@element-plus/icons-vue'

import '@/api/mock'

import {userLoginStore} from '@/store/userLogin'

const app = createApp(App)
app.use(store)
  .use(ElementPlus, {locale: zhCn})

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

const { addRouter } = userLoginStore()
addRouter(router)
// 要在路由加载完后，在挂载路由
app.use(router)

app.mount('#app')